package com.example.pcbackend.config;


import com.example.pcbackend.pojo.SysUser;

/**
 * @Description: 用户上下文，用于存储当前线程用户
 * @Author: wes
 * @Date: 2021/7/9 11:43
 */
public class UserContext {

    private final static ThreadLocal<SysUser> userThreadLocal = new ThreadLocal<>();


    public static void setUser(SysUser user) {
        userThreadLocal.set(user);
    }


    public static SysUser getUser() {
        return  userThreadLocal.get();
    }
}
